var vm;
(function ($) {
    var staff = {
        init: function () {
            vm = new Vue({
                el: "#Staff",
                // 数据
                data: {
                    manageDataFactory: {
                        name: '员工职位选择',
                        child_type: [
                            {
                                name: '总经办',
                                class_name: 'zongjingban',
                                childs: ['生产总监', '总监助理', '厂长']
                            }, {
                                name: '设计部',
                                class_name: 'shejibu',
                                childs: ['设计部', '设计师']
                            }, {
                                name: '裁剪车间',
                                class_name: 'caijianchejian',
                                childs: ['裁剪车间', '手工']
                            }, {
                                name: '缝制车间',
                                class_name: 'fengzhichejian',
                                childs: ['缝制车间', '自动']
                            }, {
                                name: '后道车间',
                                class_name: 'houdaochejian',
                                childs: ['后道车间', '推车']
                            }, {
                                name: '行政部',
                                class_name: 'xingzhengbu',
                                childs: ['行政部', '签到']
                            }, {
                                name: '人事部',
                                class_name: 'renshibu',
                                childs: ['人事部', '招聘']
                            }, {
                                name: '财务部',
                                class_name: 'caiwubu',
                                childs: ['财务部', '会计']
                            }
                        ]
                    },
                    manageDataCompany: {
                        name: '员工职位选择',
                        child_type: [
                            {
                                name: '总经办',
                                class_name: 'zongjingban',
                                childs: ['生产总监', '总监助理', '厂长']
                            }, {
                                name: '销售部',
                                class_name: 'shejibu',
                                childs: ['销售部', '销售部1111']
                            }, {
                                name: '招商部',
                                class_name: 'caijianchejian',
                                childs: ['招商部', '招商部2222']
                            }, {
                                name: '电商',
                                class_name: 'fengzhichejian',
                                childs: ['电商', '电商2222']
                            }, {
                                name: '设计部',
                                class_name: 'houdaochejian',
                                childs: ['设计部', '设计部33333']
                            }, {
                                name: '设计部',
                                class_name: 'xingzhengbu',
                                childs: ['设计部', '设计部33333333']
                            }, {
                                name: '采购部',
                                class_name: 'renshibu',
                                childs: ['采购部', '采购部5643']
                            }, {
                                name: '生产部',
                                class_name: 'caiwubu',
                                childs: ['生产部', '生产部4444444']
                            }, {
                                name: '财务部',
                                class_name: 'zongjingban1',
                                childs: ['财务部', '财务部', '财务部433333', '财务部', '财务部433333']
                            }, {
                                name: '外发部',
                                class_name: 'shejibu1',
                                childs: ['外发部', '外发部4444444444444']
                            }, {
                                name: '行政部',
                                class_name: 'caijianchejian1',
                                childs: ['行政部', '行政部55555555555']
                            }, {
                                name: '人事部',
                                class_name: 'fengzhichejian1',
                                childs: ['人事部', '人事部5444444']
                            }, {
                                name: '品控部',
                                class_name: 'houdaochejian1',
                                childs: ['品控部', '品控部653442']
                            }, {
                                name: '物流部',
                                class_name: 'xingzhengbu1',
                                childs: ['物流部', '物流部214esdsa']
                            }, {
                                name: '仓储部',
                                class_name: 'caiwubu1',
                                childs: ['仓储部', '仓储部45512145']
                            }
                        ]
                    },
                    panelLeft: false,
                    panelRight: false,
                    pages: ['EmployeeType', 'EmployeeSelect', 'BasicInfo1', 'BasicInfo2', 'Objective', 'Certification'],
                    curPage: 'EmployeeType',
                    curType: null,
                    kind: ''
                },

                // 周期
                mounted: function () {},

                // 侦听器
                watch: {},

                // 计算属性
                computed: {
                    selectFactory: function () {
                        if(this.manageDataFactory.child_type.filter((item) => item.class_name == this.kind).length > 0) {
                            return this.manageDataFactory.child_type.filter((item) => item.class_name == this.kind)[0]
                        }
                    },
                    selectCompany: function () {
                        if(this.manageDataCompany.child_type.filter((item) => item.class_name == this.kind).length > 0) {
                            return this.manageDataCompany.child_type.filter((item) => item.class_name == this.kind)[0]
                        }
                    }
                  },

                // 方法
                methods: {
                    onSelectType: function (_value) {
                        this.curType = _value
                        for(var i = 0;i < this.pages.length;i++) {
                            if(this.curPage.indexOf(this.pages[i]) > -1) {
                                this.curPage = this.curType+this.pages[i+1]
                                return
                            }
                        }
                    },
                    onNextStep: function () {
                        // 下一步
                        for(var i = 0;i < this.pages.length-1;i++) {
                            if(this.curPage.indexOf(this.pages[i]) > -1) {
                                this.curPage = this.curType+this.pages[i+1]
                                return
                            }
                        }
                        console.log("注册成功")
                    },
                    mBtnEnter: function (e) {
                        this.kind = e.target.getAttribute("className")
                        var _id = parseInt(e.target.getAttribute("dataId"));

                        if(_id % 2 == 0) {
                            this.panelLeft = true;
                            this.panelRight = false;
                        }else {
                            this.panelLeft = false;
                            this.panelRight = true;
                        }
                    },
                    mBtnLeave: function () {
                        let self = this;
                        self._timer = setTimeout(function () {
                          self.kind = ''
                        }, 20)
                    },
                    mPanlOver: function () {
                        clearTimeout(this._timer)
                    },
                    mPanlOut: function () {
                        this.kind = ''
                    }
                },

                // 周期
                created: function () {},
            })
        }
    }
    staff.init()
})(jQuery)